This invention relates to an image processing apparatus and an image processing method in which an image area is divided in order to extract an object or to effect an image compression or the like utilizing a motion compensation of every object and a recording medium readable by a computer, for example.
According to a snake which is one of the image area dividing methods (object detection methods), it is possible to approximately estimate position and shape of an object by fitting a closed curve, which is deformed geometrically, into an object (see Japanese laid-open patent application No. 9-50526)
Also, as other area dividing methods, there is known a method in which edges are extracted from an image and a scope encircled by the edges can be set to the area.
However, according to the former method, a processing for executing the initialization cannot be automated without difficulty. Moreover, there arises a problem that only an object of a simple shape can be detected.
Furthermore, the latter method encounters with a problem that although an object of a complex shape can be detected, a gradational object whose edges are not clear cannot be detected accurately.
It is an object of this invention to provide an image processing apparatus and the like in which areas of complex shape and whose edges are not clear can be detected with high accuracy.
An image processing apparatus according to this invention comprises a frequency related information generating section for generating frequency related information relating to a frequency of each pixel value based on pixels values of a plurality of pixels comprising an original image and error information, a representative value deciding section for deciding a representative value of pixel values based on the frequency related information, an accumulating section for accumulating a representative value decided by the representative value deciding section, a replacing section for replacing the pixel values of a plurality of pixels comprising the original image with the representative values accumulated in the accumulating section, an error information generating section for generating an error between pixel values of respective pixels of an outputted image of the replacing section and pixel values of a plurality of pixels comprising the original image and a control section for controlling the frequency related information generating section, the representative value deciding section, the accumulating section, the replacing section and the error information generating section such that these sections may be operated repeatedly until a predetermined condition is satisfied.
An image processing method according to this invention comprises the steps of generating frequency related information related to frequencies of respective pixel values based on pixel values of a plurality of pixels comprising an original image and error information, deciding a representative value of a pixel value based on the frequency related information, accumulating the decided representative value, replacing pixel values of a plurality of pixels comprising the original image with the accumulated representative values, generating the error information indicative of errors between pixel values of respective pixels of an outputted image obtained by the replacement and pixel values of a plurality of pixels comprising the original image and controlling the frequency related information generation step, the representative value deciding step, the representative value accumulating step, the representative value replacing step and the error information generating step such that the respective steps may be executed repeatedly until a predetermined condition is satisfied.
A computer-readable-recording medium for recording thereon a program for enabling a computer to execute the steps of generating frequency related information related to frequencies of respective pixels based on pixel values of a plurality of pixels comprising an original image and error information, deciding a representative value of a pixel value based on the frequency related information, accumulating the decided representative value, replacing the pixel values of a plurality of pixels comprising the original image with the accumulated representative values, generating the error information for indicating errors between the pixel values of respective pixels of an outputted image obtained by the replacement and the pixel values of a plurality of pixels comprising the original image and controlling the frequency related information generating step, the representative value deciding step, the representative value accumulating step, the representative value replacing step and the error information generating step such that these steps may be repeatedly executed until a predetermined condition is satisfied.
In this invention, frequency related information related to frequencies of respective pixel values may be generated based on pixel values of a plurality of pixels comprising an original image and error information. For example, in the first operation of the repetitive operations, the frequency related information may be generated based on only the pixel values of a plurality of pixels. In the operation following the second operation in the repetitive operations, the frequency related information may be generated based on both of the pixel values of a plurality of pixels and error information. Moreover, for example, frequencies of pixel values of a plurality of pixels comprising the original image may be detected from all available pixel values of the original image, and the frequency related information may be generated by multiplying this frequency with the errors corresponding to the respective pixel values contained in the error information at every corresponding pixel value.
Then, a representative value of a pixel value may be decided based on the frequency related information thus generated. The representative value thus decided may be accumulated, and the pixel values of a plurality of pixels comprising the original image may be replaced with the representative values thus accumulated. For example, the pixel values of the respective pixels comprising the original image may be replaced with a representative value having a minimum error of at least one accumulated representative value, and thereby an outputted image may be obtained.
Error information used when the frequency related information is generated may be generated by detecting errors between pixel values of all available pixel values of the original image, for example, and the accumulated representative values. Moreover, for example, error information may be obtained by detecting errors between the pixel values of the respective pixels of the outputted image obtained by the replacement and the pixel values of the respective pixels of the original image.
Then, the operation for generating the frequency related information, the operation for deciding the representative value, the operation for accumulating the representative value and the operation for replacing the pixel values of a plurality of pixels comprising the original image with the representative value may be repeatedly executed until a predetermined condition is satisfied. The predetermined condition may be such one that the maximum value of the errors contained in the error information, for example, may be less than a threshold value or that the number of the repetitive operations may become greater than a threshold value. A series of the above-mentioned operations may be repeated, whereby the outputted image comprising a plurality of areas in which the pixel values of pixels within each area are the same may be obtained. According to this invention, the area having a complex shape and whose edges are not clear can be divided with high accuracy.